package com.sx.zongzhi.adapter;

import android.content.Context;
import android.widget.TextView;

import com.sx.zongzhi.R;
import com.zhy.adapter.abslistview.CommonAdapter;
import com.zhy.adapter.abslistview.ViewHolder;

import java.util.List;

/**
 * Created by XZY on 2017/11/23.
 * 文字选择带选中状态
 */
public class TextSelectAdapter extends CommonAdapter<String> {

    private int selectItem;

    public TextSelectAdapter(Context context, int layoutId, List<String> datas) {
        super(context, layoutId, datas);
    }

    public void setItemSelect(int position){
        selectItem=position;
        notifyDataSetChanged();
    }

    @Override
    protected void convert(ViewHolder viewHolder, String item, int position) {
        TextView textView=viewHolder.getView(R.id.tv_Content);
        textView.setText(item);
        if (selectItem == position) {
            textView.setEnabled(true);
        } else {
            textView.setEnabled(false);
        }

    }
}
